//
//  BN_ClassParentCell.m
//  BabyNow
//
//  Created by 刘泽琛 on 14-6-16.
//  Copyright (c) 2014年 iMobile. All rights reserved.
//
#import "ALAssetsLibrary+CustomPhotoAlbum.h"
#import <QuartzCore/QuartzCore.h>
#import "BN_ClassParentCell.h"
#import "BN_DynamicHelper.h"
#import "BN_NoticeHelper.h"

#define imginterval 2
#define OBJECT_SPACE 5
static int getTimes = 0;

@implementation BN_ClassParentCell {
    NSInteger imageCount_;
    NSMutableArray *imgURLArr_;
    UIImageView *shadeView_;

    BN_DynamicHelper *dynamicHelper_;
    BN_UserInfo *userInfo_;
    iMB_DownloadNetVideo *downloadNetVideo_;
}

- (void)awakeFromNib
{
    self.greenColor = APP_OBJECT_GREEN_COLOR;
    // 用户名称
    self.disPlayImageView.frame = CGRectZero;
    self.contentTextLabel.frame = CGRectZero;
    self.discLikeFengxiangView.frame = CGRectZero;
    self.replView.frame = CGRectZero;
    
    // 界面颜色
    self.userNameLabel.textColor = self.greenColor;
    self.backgroundColor = APP_OBJECT_GRAY_COLOR;
    self.contentView.backgroundColor = APP_OBJECT_GRAY_COLOR;
    self.headerView.backgroundColor = APP_OBJECT_GRAY_COLOR;
    self.disPlayImageView.backgroundColor = [UIColor clearColor];
    self.contentTextLabel.backgroundColor = APP_OBJECT_GRAY_COLOR;
    self.discLikeFengxiangView.backgroundColor = APP_OBJECT_GRAY_COLOR;
    self.replView.backgroundColor = APP_OBJECT_GRAY_COLOR;
    
    // 事件
    self.disPlayImageView.userInteractionEnabled = YES;
    self.userPhotoImageView.userInteractionEnabled = YES;
    UITapGestureRecognizer *headPhotoTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(headPhotoAction:)];
    [self.userPhotoImageView addGestureRecognizer:headPhotoTap];
    
    
    [self.pinglunBtn addTarget:self action:@selector(pinglunAction) forControlEvents:UIControlEventTouchUpInside];
    [self.fenxiangBtn addTarget:self action:@selector(fenxiangAction) forControlEvents:UIControlEventTouchUpInside];
    
    // helper
    if (!dynamicHelper_) {
        dynamicHelper_ = [[BN_DynamicHelper alloc]init];
    }
    
    if (!userInfo_) {
        userInfo_ = [BN_UserHelper unArchiverAccountInfo];
    }
    if (!_userType) {
        _userType = [userInfo_.userType integerValue];
    }
    
    // 广播随时移除视频播放器
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(removeMovieView) name:@"K_ANYTIME_REMOVE_MOVIE" object:nil];
}

#pragma mark 
#pragma mark Block
- (void)toUpdateListData:(UpdateListData)updateData {
    self.updateData = updateData;
}

#pragma mark
#pragma mark UI组合

- (void)groupVideo:(NSArray *)videoArray {
    
    // 视频播放状态设置为非全屏
    [[NSUserDefaults standardUserDefaults]setBool:NO forKey:USERDEFAULTS_VIDEO_STYLE];
    [[NSUserDefaults standardUserDefaults]synchronize];
    
    // 配置界面尺寸
    self.disPlayImageView.frame = CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_WIDTH);
    [self toGroupOtherView];
    
    // 初始化imgView数组
    imgURLArr_ = [NSMutableArray arrayWithCapacity:0];
    
    // 此imageView放到disPlayImageView,
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_WIDTH)];
    imageView.backgroundColor = APP_IMG_VIEW_BACK_COLOR;
    imageView.tag = 100;
    // 缩略图地址
    NSDictionary *imgDic;
    NSDictionary *videoDic;
    if (videoArray.count == 2) {
        imgDic = videoArray[0];
        videoDic = videoArray[1];
    }else {
        imgDic = videoArray[0];
        videoDic = videoArray[0];
    }
    NSString *imgURLString = [THUMBNAIL_BASEURL stringByAppendingString:imgDic[@"fileTUrl"]];
    NSString *videoUrlStr = [THUMBNAIL_BASEURL stringByAppendingString:videoDic[@"fileUrl"]];
    self.videoUrl = [NSURL URLWithString:videoUrlStr];
    // 从网络上获取图片数据
    NSURL *imgURL = [NSURL URLWithString:imgURLString];
    self.videoThumbnailImageUrl = imgURL;
    [imageView  setImageWithURL:self.videoThumbnailImageUrl  placeholderImage:nil];
    imageView.clipsToBounds = YES;
    imageView.contentMode = UIViewContentModeScaleAspectFill;

    // 播放按钮图片
    UIImageView *playBtnImgView = [[UIImageView alloc]initWithFrame:CGRectMake((SCREEN_WIDTH-80)/2, (SCREEN_WIDTH-80)/2, 80, 80)];
    playBtnImgView.image = [UIImage imageNamed:@"bofang"];
    [imageView addSubview:playBtnImgView];
    imageView.userInteractionEnabled = YES;
    
    // 单击缩略图请求网络数据
    UITapGestureRecognizer *playVideoTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(playVideoAction:)];
    [imageView addGestureRecognizer:playVideoTap];

    
    [imgURLArr_ addObject:imgURLString];
    [self.disPlayImageView addSubview:imageView];
        
}

- (void)groupImageView:(NSArray *)imgArray {

    imageCount_ = imgArray.count;
    switch (imageCount_) {
        case 1:
            self.disPlayImageView.frame = CGRectMake(0, 64, SCREEN_WIDTH, SCREEN_WIDTH);
            [self toGroupOtherView];
            
            // 初始化imgView数组
            imgURLArr_ = [NSMutableArray arrayWithCapacity:0];
            for (int i = 0; i < imageCount_; i++) {
                // 缩略图地址
                NSDictionary *imgDic = imgArray[0];
                NSString *imgURLString = [THUMBNAIL_BASEURL stringByAppendingString:imgDic[@"fileTUrl"]];
                // 从网络上获取图片数据
                NSURL *imgURL = [NSURL URLWithString:imgURLString];
                UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_WIDTH)];
                [imageView setImageWithURL:imgURL];
                imageView.clipsToBounds = YES;
                imageView.contentMode = UIViewContentModeScaleAspectFill;
                imageView.backgroundColor = APP_IMG_VIEW_BACK_COLOR;
                // 图片tag值
                imageView.tag = i;
                imageView.userInteractionEnabled = YES;
                UITapGestureRecognizer *openFullViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(openFullView:)];
                [imageView addGestureRecognizer:openFullViewTap];
                [imgURLArr_ addObject:imgURLString];
                [self.disPlayImageView addSubview:imageView];
            }
            break;
            
        case 2:
            
            self.disPlayImageView.frame = CGRectMake(0, 64, 320, 159);
            [self toGroupOtherView];

            // 初始化imgView数组
            imgURLArr_ = [NSMutableArray arrayWithCapacity:0];
            for (int i = 0; i < imageCount_; i++) {
                
                // 缩略图地址
                NSDictionary *imgDic = imgArray[i];
                NSString *imgURLString = [THUMBNAIL_BASEURL stringByAppendingString:imgDic[@"fileTUrl"]];
                
                // 从网络上获取图片数据
                NSURL *imgURL = [NSURL URLWithString:imgURLString];
                
                UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(i*159+i*imginterval, 0, 160, 159)];
                imgView.clipsToBounds = YES;
                imgView.contentMode = UIViewContentModeScaleAspectFill;
                imgView.backgroundColor = APP_IMG_VIEW_BACK_COLOR;
                [imgView setImageWithURL:imgURL placeholderImage:nil];
                
                // 图片tag值
                imgView.tag = i;
                imgView.userInteractionEnabled = YES;
                UITapGestureRecognizer *openFullViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(openFullView:)];
                [imgView addGestureRecognizer:openFullViewTap];
                [imgURLArr_ addObject:imgURLString];
                [self.disPlayImageView addSubview:imgView];
            }
            break;
            
        case 3:
            
            self.disPlayImageView.frame = CGRectMake(0, 64, 320, 105);
            [self toGroupOtherView];

            // 初始化imgView数组
            imgURLArr_ = [NSMutableArray arrayWithCapacity:0];
            
            for (int i = 0; i < imageCount_; i++) {
                
                // 缩略图地址
                NSDictionary *imgDic = imgArray[i];
                NSString *imgURLString = [THUMBNAIL_BASEURL stringByAppendingString:imgDic[@"fileTUrl"]];
                
                // 从网络上获取图片数据
                NSURL *imgURL = [NSURL URLWithString:imgURLString];
                UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(i*105+i*imginterval, 0, 106, 105)];
                imgView.clipsToBounds = YES;
                imgView.contentMode = UIViewContentModeScaleAspectFill;
                imgView.backgroundColor = APP_IMG_VIEW_BACK_COLOR;
                [imgView setImageWithURL:imgURL placeholderImage:nil];
                imgView.tag = i;
                imgView.userInteractionEnabled = YES;
                UITapGestureRecognizer *openFullViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(openFullView:)];
                [imgView addGestureRecognizer:openFullViewTap];
                [imgURLArr_ addObject:imgURLString];
                [self.disPlayImageView addSubview:imgView];
            }
            break;
            
        case 4:
            
            self.disPlayImageView.frame = CGRectMake(0, 64, 320, 320);
            [self toGroupOtherView];

            // 初始化imgView数组
            imgURLArr_ = [NSMutableArray arrayWithCapacity:0];
            
            for (int i = 0; i < 2; i++) {
                for (int j = 0; j < 2; j++) {
                    
                    NSDictionary *imgDic = imgArray[getTimes];
                    // 缩略图地址
                    NSString *imgURLString = [THUMBNAIL_BASEURL stringByAppendingString:imgDic[@"fileTUrl"]];
                    
                    // 从网络上获取图片数据
                    NSURL *imgURL = [NSURL URLWithString:imgURLString];
                    UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(j*159+j*imginterval, 159*i+i*imginterval, 160, 160)];
                    imgView.clipsToBounds = YES;
                    imgView.contentMode = UIViewContentModeScaleAspectFill;
                    imgView.backgroundColor = APP_IMG_VIEW_BACK_COLOR;
                    [imgView setImageWithURL:imgURL placeholderImage:nil];
                    imgView.userInteractionEnabled = YES;
                    UITapGestureRecognizer *openFullViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(openFullView:)];
                    [imgView addGestureRecognizer:openFullViewTap];
                    imgView.tag = getTimes;
                    [imgURLArr_ addObject:imgURLString];
                    [self.disPlayImageView addSubview:imgView];
                    getTimes++;
                    
                }
            }
            getTimes = 0;
            break;
            
        case 5:
            
            self.disPlayImageView.frame = CGRectMake(0, 64, 320, 214);
            [self toGroupOtherView];

            // 初始化imgView数组
            imgURLArr_ = [NSMutableArray arrayWithCapacity:0];
            
            for (int i = 0; i < 2; i++) {
                for (int j = 0; j < 3; j++) {
                    if (i== 1 && j== 2) {
                        getTimes = 0;
                        return;
                    }
                    
                    NSDictionary *imgDic = imgArray[getTimes];
                    
                    // 缩略图地址
                    NSString *imgURLString = [THUMBNAIL_BASEURL stringByAppendingString:imgDic[@"fileTUrl"]];
                    
                    // 从网络上获取图片数据
                    NSURL *imgURL = [NSURL URLWithString:imgURLString];
                    UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(j*105+j*imginterval, 105*i+i*imginterval, 106, 106)];
                    imgView.clipsToBounds = YES;
                    imgView.contentMode = UIViewContentModeScaleAspectFill;
                    imgView.backgroundColor = APP_IMG_VIEW_BACK_COLOR;
                    [imgView setImageWithURL:imgURL placeholderImage:nil];
                    // 图片添加手势
                    imgView.userInteractionEnabled = YES;
                    UITapGestureRecognizer *openFullViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(openFullView:)];
                    [imgView addGestureRecognizer:openFullViewTap];
                    // 添加图片的tag值，根据tag取到全屏浏览模式下当前的页数
                    imgView.tag = getTimes;
                    // 图片URL数组添加元素
                    [imgURLArr_ addObject:imgURLString];
                    [self.disPlayImageView addSubview:imgView];
                    getTimes++;
                }
            }
            break;
            
        case 6:
            self.disPlayImageView.frame = CGRectMake(0, 64, 320, 106*2);
            [self toGroupOtherView];

            // 初始化imgView数组
            imgURLArr_ = [NSMutableArray arrayWithCapacity:0];
            
            for (int i = 0; i < 2; i++) {
                for (int j = 0; j < 3; j++) {
                    
                    NSDictionary *imgDic = imgArray[getTimes];
                    // 缩略图地址
                    NSString *imgURLString = [THUMBNAIL_BASEURL stringByAppendingString:imgDic[@"fileTUrl"]];
                    
                    // 从网络上获取图片数据
                    NSURL *imgURL = [NSURL URLWithString:imgURLString];
                    UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(j*105+j*imginterval, 105*i+i*imginterval, 106, 106)];
                    imgView.clipsToBounds = YES;
                    imgView.contentMode = UIViewContentModeScaleAspectFill;
                    imgView.backgroundColor = APP_IMG_VIEW_BACK_COLOR;
                    [imgView setImageWithURL:imgURL placeholderImage:nil];
                    // 图片添加手势
                    imgView.userInteractionEnabled = YES;
                    UITapGestureRecognizer *openFullViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(openFullView:)];
                    [imgView addGestureRecognizer:openFullViewTap];
                    // 添加图片的tag值，根据tag取到全屏浏览模式下当前的页数
                    imgView.tag = getTimes;
                    // 图片URL数组添加元素
                    [imgURLArr_ addObject:imgURLString];
                    
                    [self.disPlayImageView addSubview:imgView];
                    getTimes++;
                    if (i== 1 && j== 2) {
                        getTimes = 0;
                        return;
                    }
                }
            }
            break;
            
        case 7:
            self.disPlayImageView.frame = CGRectMake(0, 64, 320, 106*3);
            [self toGroupOtherView];

            // 初始化imgView数组
            imgURLArr_ = [NSMutableArray arrayWithCapacity:0];
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    
                    if (i== 2 && j== 1) {
                        getTimes = 0;
                        return;
                    }
                    NSDictionary *imgDic = imgArray[getTimes];
                    // 缩略图地址
                    NSString *imgURLString = [THUMBNAIL_BASEURL stringByAppendingString:imgDic[@"fileTUrl"]];
                    
                    // 从网络上获取图片数据
                    NSURL *imgURL = [NSURL URLWithString:imgURLString];
                    UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(j*105+j*imginterval, 105*i+i*imginterval, 106, 106)];
                    imgView.clipsToBounds = YES;
                    imgView.contentMode = UIViewContentModeScaleAspectFill;
                    imgView.backgroundColor = APP_IMG_VIEW_BACK_COLOR;
                    [imgView setImageWithURL:imgURL placeholderImage:nil];
                    // 图片添加手势
                    imgView.userInteractionEnabled = YES;
                    UITapGestureRecognizer *openFullViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(openFullView:)];
                    [imgView addGestureRecognizer:openFullViewTap];
                    // 添加图片的tag值，根据tag取到全屏浏览模式下当前的页数
                    imgView.tag = getTimes;
                    // 图片URL数组添加元素
                    [imgURLArr_ addObject:imgURLString];
                    
                    [self.disPlayImageView addSubview:imgView];
                    getTimes++;
                    
                }
            }
            break;
            
        case 8:
            self.disPlayImageView.frame = CGRectMake(0, 64, 320, 106*3);
            [self toGroupOtherView];

            // 初始化imgView数组
            imgURLArr_ = [NSMutableArray arrayWithCapacity:0];
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    
                    if (i== 2 && j== 2) {
                        getTimes = 0;
                        return;
                    }
                    NSDictionary *imgDic = imgArray[getTimes];
                    // 缩略图地址
                    NSString *imgURLString = [THUMBNAIL_BASEURL stringByAppendingString:imgDic[@"fileTUrl"]];
                    
                    // 从网络上获取图片数据
                    NSURL *imgURL = [NSURL URLWithString:imgURLString];
                    UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(j*105+j*imginterval, 105*i+i*imginterval, 106, 106)];
                    imgView.clipsToBounds = YES;
                    imgView.contentMode = UIViewContentModeScaleAspectFill;
                    imgView.backgroundColor = APP_IMG_VIEW_BACK_COLOR;
                    [imgView setImageWithURL:imgURL placeholderImage:nil];
                    // 图片添加手势
                    imgView.userInteractionEnabled = YES;
                    UITapGestureRecognizer *openFullViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(openFullView:)];
                    [imgView addGestureRecognizer:openFullViewTap];
                    // 添加图片的tag值，根据tag取到全屏浏览模式下当前的页数
                    imgView.tag = getTimes;
                    // 图片URL数组添加元素
                    [imgURLArr_ addObject:imgURLString];
                    
                    [self.disPlayImageView addSubview:imgView];
                    getTimes++;
                }
            }
            break;
            
        case 9:
            self.disPlayImageView.frame = CGRectMake(0, 64, 320, 106*3);
            [self toGroupOtherView];

            // 初始化imgView数组
            imgURLArr_ = [NSMutableArray arrayWithCapacity:0];
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 3; j++) {
                    
                    NSDictionary *imgDic = imgArray[getTimes];
                    // 缩略图地址
                    NSString *imgURLString = [THUMBNAIL_BASEURL stringByAppendingString:imgDic[@"fileTUrl"]];
                    
                    // 从网络上获取图片数据
                    NSURL *imgURL = [NSURL URLWithString:imgURLString];
                    UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectMake(j*105+j*imginterval, 105*i+i*imginterval, 106, 106)];
                    imgView.clipsToBounds = YES;
                    imgView.contentMode = UIViewContentModeScaleAspectFill;
                    imgView.backgroundColor = APP_IMG_VIEW_BACK_COLOR;
                    [imgView setImageWithURL:imgURL placeholderImage:nil];
                    // 图片添加手势
                    imgView.userInteractionEnabled = YES;
                    UITapGestureRecognizer *openFullViewTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(openFullView:)];
                    [imgView addGestureRecognizer:openFullViewTap];
                    // 添加图片的tag值，根据tag取到全屏浏览模式下当前的页数
                    imgView.tag = getTimes;
                    // 图片URL数组添加元素
                    [imgURLArr_ addObject:imgURLString];
                    [self.disPlayImageView addSubview:imgView];
                    getTimes++;
                }
            }
            getTimes = 0;
            break;
        default:
            self.disPlayImageView.frame = CGRectMake(0, 54, 320, 0);
            [self toGroupOtherView];
            break;
    }
}

- (void)toGroupOtherView {
    // 文字内容
    self.contentTextLabel.numberOfLines = 0;
    UIFont *contLabelfont = [UIFont systemFontOfSize:APP_CONTENT_FONT_SIZE];
    self.contentTextLabel.font = contLabelfont;
    self.contentTextLabel.lineBreakMode = NSLineBreakByCharWrapping ;
    CGSize contLabelsize = CGSizeMake(296,10000);
    self.contentTextLabel.backgroundColor = [UIColor clearColor];
    NSDictionary * contLabeldic = [NSDictionary dictionaryWithObjectsAndKeys:contLabelfont,NSFontAttributeName,nil];
    CGSize contLabelActualsize = [self getTextSize:contLabelsize disFont:contLabelfont contentStr:self.contentTextLabel.text contextDic:contLabeldic];
    if (self.contentTextLabel.text.length > 0) {
        self.contentTextLabel.frame = CGRectMake(12, CGRectGetMaxY(self.disPlayImageView.frame)+OBJECT_SPACE, 296, contLabelActualsize.height);
    }else {
        self.contentTextLabel.frame = CGRectMake(12, CGRectGetMaxY(self.disPlayImageView.frame)+OBJECT_SPACE, 296, 0);
    }
    [self.contentTextLabel sizeToFit];
    
    // 评论、点赞、分享按钮
    self.discLikeFengxiangView.frame = CGRectMake(0, CGRectGetMaxY(self.contentTextLabel.frame)+OBJECT_SPACE, SCREEN_WIDTH, 36);
    
    // 回复视图
    self.replView.frame = CGRectMake(0, CGRectGetMaxY(self.discLikeFengxiangView.frame)+OBJECT_SPACE, SCREEN_WIDTH, [self dealreplView]);
    self.cellHeight = CGRectGetMaxY(self.replView.frame)+OBJECT_SPACE;

}

- (CGFloat)dealreplView {
    
    // 评论数要求3行显示.大于=3条评论，第一行显示查看更多，2、3行显示最新2条评论
    if (self.replTime >= 3) {
        
        self.singleRelpHeight = 23;
        self.replTime = 2;
        
        for (int i = 0; i < 3; i++) {
            if (i == 0) {
                UIButton *allPinglunBtn = [UIButton buttonWithType:UIButtonTypeCustom];
                allPinglunBtn.frame = CGRectMake(12, 0, 100, 20);
                [allPinglunBtn addTarget:self action:@selector(toViewPinglunVC) forControlEvents:UIControlEventTouchUpInside];
                allPinglunBtn.titleEdgeInsets =  UIEdgeInsetsMake(0 ,-15, 0, 0);
                [allPinglunBtn setTitle:@"查看全部评论" forState:UIControlStateNormal];
                allPinglunBtn.titleLabel.font = [UIFont systemFontOfSize:14];
                [allPinglunBtn setTitleColor:APP_OBJECT_GREEN_COLOR forState:UIControlStateNormal];
                [self.replView addSubview:allPinglunBtn];
            }else {
                // replUserName replCont
                NSString *name = FORMAT_STR(self.replArr[i-1][@"replUserName"]);
                NSString *content = FORMAT_STR(self.replArr[i-1][@"replCont"]);
                // replName
                UILabel *replNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(12, self.singleRelpHeight, 0, 20)];
                replNameLabel.text = [name stringByAppendingString:@" : "];
                replNameLabel.backgroundColor = [UIColor clearColor];
                replNameLabel.textColor = self.greenColor;
                replNameLabel.tag = 10+i;
                replNameLabel.font = [UIFont systemFontOfSize:14.0f];
                [self.replView addSubview:replNameLabel];
                [replNameLabel sizeToFit];
                
                // replContent
                UILabel *replCountLabel = [[UILabel alloc]init];
                replCountLabel.text = content;
                replCountLabel.backgroundColor = [UIColor clearColor];
                replCountLabel.tag = 20+i;
                replCountLabel.numberOfLines = 0;
                UIFont *contLabelfont = [UIFont systemFontOfSize:14];
                replCountLabel.font = contLabelfont;
                replCountLabel.lineBreakMode = NSLineBreakByCharWrapping ;
                CGSize contLabelsize = CGSizeMake(SCREEN_WIDTH-12*2-(CGRectGetWidth(replNameLabel.frame)),10000);
                NSDictionary * contLabeldic = [NSDictionary dictionaryWithObjectsAndKeys:contLabelfont,NSFontAttributeName,nil];
                CGSize contLabelActualsize = [self getTextSize:contLabelsize disFont:contLabelfont contentStr:replCountLabel.text contextDic:contLabeldic];
                replCountLabel.frame = CGRectMake(CGRectGetMaxX(replNameLabel.frame), self.singleRelpHeight, SCREEN_WIDTH-12*2-(CGRectGetWidth(replNameLabel.frame)), contLabelActualsize.height);
                [self.replView addSubview:replCountLabel];
                
                self.singleRelpHeight = CGRectGetMaxY(replCountLabel.frame)+OBJECT_SPACE;
                self.relpHeight = CGRectGetMaxY(replCountLabel.frame)+10.0f;
            }
        }
    }else {
        self.singleRelpHeight = 0;
        for (int i = 0; i < self.replTime; i++) {
            // replUserName replCont
            NSString *name = self.replArr[i][@"replUserName"];
            NSString *content = self.replArr[i][@"replCont"];
            
            // replName
            UILabel *replNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(12, self.singleRelpHeight, 0, 20)];
            replNameLabel.text = [name stringByAppendingString:@" : "];
            replNameLabel.backgroundColor = [UIColor clearColor];
            replNameLabel.textColor = self.greenColor;
            replNameLabel.font = [UIFont systemFontOfSize:14.0f];
            [self.replView addSubview:replNameLabel];
            [replNameLabel sizeToFit];
            
            // replContent
            UILabel *replCountLabel = [[UILabel alloc]init];
            replCountLabel.text = content;
            replCountLabel.backgroundColor = [UIColor clearColor];
            
            replCountLabel.numberOfLines = 0;
            UIFont *contLabelfont = [UIFont systemFontOfSize:14];
            replCountLabel.font = contLabelfont;
            replCountLabel.lineBreakMode = NSLineBreakByCharWrapping ;
            CGSize contLabelsize = CGSizeMake(SCREEN_WIDTH-12*2-(CGRectGetWidth(replNameLabel.frame)),10000);
            NSDictionary * contLabeldic = [NSDictionary dictionaryWithObjectsAndKeys:contLabelfont,NSFontAttributeName,nil];
            CGSize contLabelActualsize = [self getTextSize:contLabelsize disFont:contLabelfont contentStr:replCountLabel.text contextDic:contLabeldic];
            replCountLabel.frame = CGRectMake(CGRectGetMaxX(replNameLabel.frame), self.singleRelpHeight, SCREEN_WIDTH-12*2-(CGRectGetWidth(replNameLabel.frame)), contLabelActualsize.height);
            [self.replView addSubview:replCountLabel];
            self.singleRelpHeight = CGRectGetMaxY(replCountLabel.frame)+OBJECT_SPACE;
            self.relpHeight = CGRectGetMaxY(replCountLabel.frame)+10.0f;
        }
    }
    return self.relpHeight;
}

- (void)dealLikeBtnColorState {
    self.xihuanBtn.transform = CGAffineTransformMakeScale(1.0, 1.0);
    self.xihuanBtn.enabled = YES;
    NSInteger praiTime = [self.praiTime integerValue];
    if (praiTime > 0) {
        [self.xihuanBtn setImage:[UIImage imageNamed:@"dianjixihuan"] forState:UIControlStateNormal];
    }else {
        [self.xihuanBtn setImage:[UIImage imageNamed:@"xihuan"] forState:UIControlStateNormal];
    }
    [self.xihuanBtn addTarget:self action:@selector(xihuanAction) forControlEvents:UIControlEventTouchUpInside];
}

// 封装自动撑开高度的方法
- (CGSize)getTextSize:(CGSize)provisionsSize disFont:(UIFont *)font contentStr:(NSString *)contentStr contextDic:(NSDictionary *)contextDic {
    CGSize size;
    switch (MAIN_VERSION) {
        case 6:
            size = [contentStr sizeWithFont:font constrainedToSize:provisionsSize lineBreakMode:NSLineBreakByWordWrapping];
            break;
        default:
            size =[contentStr boundingRectWithSize:provisionsSize options:NSStringDrawingUsesLineFragmentOrigin |NSStringDrawingUsesFontLeading attributes:contextDic context:nil].size;
            
            break;
    }
    return size;
}

#pragma mark
#pragma mark Actions
- (void)headPhotoAction:(UITapGestureRecognizer *)tap {
    NSLog(@"头像点击 userType%ld userId%ld",(long)self.postUserType,(long)self.postUserId);
    NSString *postUserTypeStr = [NSString stringWithFormat:@"%ld",(long)self.postUserType];
    NSString *postUserIdStr = [NSString stringWithFormat:@"%ld",(long)self.postUserId];
    NSArray *sendArr = @[postUserTypeStr,postUserIdStr];
    [[NSNotificationCenter defaultCenter]postNotificationName:K_LOOK_OTHER_PERSONAL_INFO object:sendArr];
} // 头像点击

- (void)openFullView:(UITapGestureRecognizer *)tap {
    NSInteger count = imgURLArr_.count;
    NSMutableArray *photos = [NSMutableArray arrayWithCapacity:count];
    for (int i = 0; i<count; i++) {
        MJPhoto *photo = [[MJPhoto alloc] init];
        photo.url = [NSURL URLWithString:imgURLArr_[i]];
        photo.srcImageView = self.disPlayImageView.subviews[i];
        [photos addObject:photo];
    }
    
    MJPhotoBrowser *browser = [[MJPhotoBrowser alloc] init];
    browser.currentPhotoIndex = tap.view.tag;
    browser.photos = photos;
    [browser show];
}

- (void)toViewPinglunVC {
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setBool:NO forKey:@"USERDEFAULTS_PINGLUN_TYPE"];
    [userDefaults synchronize];
    
    [[NSNotificationCenter defaultCenter]postNotificationName:KPUSHCONTROLLER_PINGLUN  object:self.postId];
}

- (void)pinglunAction {
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    [userDefaults setBool:YES forKey:@"USERDEFAULTS_PINGLUN_TYPE"];
    [userDefaults synchronize];
    
    [[NSNotificationCenter defaultCenter]postNotificationName:KPUSHCONTROLLER_PINGLUN  object:self.postId];
}

- (void)xihuanAction {
    self.xihuanBtn.enabled = NO;
    [self likeAnimation:self.xihuanBtn];
    __weak typeof (self) weakSelf = self;
    [dynamicHelper_ supportDynamicWithPostId:self.postId  flg:self.praiFlg completeHandler:^(id result, NSString *errMsg) {
        if (errMsg) {
            weakSelf.xihuanBtn.enabled = YES;
            [LZCHINT title:errMsg type:LZCError duration:2 places:HINT_PLACES callBack:NULL];
        }else{
            weakSelf.xihuanBtn.enabled = YES;
            // 网络请求成功后，更改model中网络数组
            switch (self.praiFlg) {
                case 0:
                    self.praiFlg = 1;
                    break;
                case 1:
                    self.praiFlg = 0;
                    break;
                default:
                    break;
            }
            // tag = self.tag
            NSInteger classOrParent = [[NSUserDefaults standardUserDefaults]integerForKey:USERDEFAULTS_CLASSPARENT];
            NSString *tag_ = [NSString stringWithFormat:@"%ld",(long)self.tag];
            NSString *praiFlg_ = [NSString stringWithFormat:@"%d",self.praiFlg];
            NSArray *sendArr = @[tag_,praiFlg_];
            switch (classOrParent) {
                case 0:
                    [[NSNotificationCenter defaultCenter]postNotificationName:K_CLASS_LIKE_NETARRAY_VALUE object:sendArr];
                    break;
                case 1:
                    [[NSNotificationCenter defaultCenter]postNotificationName:K_PARENT_LIKE_NETARRAY_VALUE object:sendArr];
                    break;
                default:
                    break;
            }
            // end
        }
    }];
}

- (void)fenxiangAction {
    NSArray *itemNameArr = nil;
    switch (_userType) {
        case ENUM_ROLE_LEADER:
        {
            itemNameArr = @[@"删除动态",@"举报此动态"];
        }
            break; // 园长
        case ENUM_ROLE_CLASS_TEACHER:
        {
            itemNameArr = @[@"删除动态",@"举报此动态"];
        }
            break; // 班级老师
        
        case ENUM_ROLE_PARENT:
        {
            itemNameArr = @[@"收藏动态",@"举报此动态"];
        }
            break; // 家长
        default:
            break;
    }
    
    UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"取消"
   destructiveButtonTitle:nil
        otherButtonTitles:itemNameArr[0],itemNameArr[1],nil];
    actionSheet.tag = 150;
    actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
    [actionSheet showInView:self.contentView];
}

- (void)parentShareAction {
     switch (self.favoFlg) {
         case 0:
         {
             [dynamicHelper_ collectDynamicWithPostId:self.postId completeHandler:^(id result, NSString *errMsg) {
                 if (errMsg) {
                     [LZCHINT title:@"收藏失败" type:LZCError duration:3 places:HINT_PLACES callBack:NULL];
                 }else{
                     [LZCHINT title:@"已转到我的主页" type:LZCSuccess duration:3 places:HINT_PLACES callBack:NULL];
                     NSString *tag = [NSString stringWithFormat:@"%ld",(long)self.tag];
                     NSInteger classOrParent = [[NSUserDefaults standardUserDefaults]integerForKey:USERDEFAULTS_CLASSPARENT];
                     switch (classOrParent) {
                         case 0:
                             [[NSNotificationCenter defaultCenter]postNotificationName:K_CLASS_SHARE_NETARRAY_VALUE object:tag];
                             break;
                         case 1:
                             [[NSNotificationCenter defaultCenter]postNotificationName:K_PARENT_SHARE_NETARRAY_VALUE object:tag];
                             break;
                         default:
                             break;
                     }
                 }
             }];
         }
             break;
         case 1:
             dispatch_async(dispatch_get_main_queue(), ^{
                 [LZCHINT title:@"已收藏" type:LZCInfo duration:3 places:HINT_PLACES callBack:NULL];
             });
             break;
         default:
             break;
        }
}

- (void)deleteAction {
    UIAlertView *deleAlrtView = [[UIAlertView alloc]initWithTitle:@"提示" message:@"是否删除此条动态?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
    deleAlrtView.tag = 101;
    [deleAlrtView show];
}

#pragma mark
#pragma mark 视频代码段
- (void)playVideoAction:(UITapGestureRecognizer *)tap {
    for (UIView *view in self.disPlayImageView.subviews) {
        [view removeFromSuperview];
    }
    [self.moviePlayer pause];
    if (!self.moviePlayer) {
        self.moviePlayer = [[MPMoviePlayerController alloc] init];
    }
    self.moviePlayer.view.hidden = NO;
    self.moviePlayer.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_WIDTH);
    if ([IMB_NetUtils checkWifiNet]) {
        [self.moviePlayer setContentURL:self.videoUrl];
        [self.moviePlayer prepareToPlay];// 在WiFi状态下自动播放
    }else {
        UIAlertView *netWarningView = [[UIAlertView alloc]initWithTitle:@"" message:@"系统检查设备处于2G/3G状态,观看视频会产生一定的流量!" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        netWarningView.tag = 100;
        [netWarningView show];// 在2G下点击播放
    }
    self.moviePlayer.controlStyle = MPMovieControlStyleNone;
    [self.disPlayImageView addSubview:self.moviePlayer.view];
    
    // 遮罩视图
    shadeView_ = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_WIDTH)];
    shadeView_.userInteractionEnabled = YES;
    shadeView_.tag = 101;
    [shadeView_ setImageWithURL:self.videoThumbnailImageUrl  placeholderImage:nil];
    shadeView_.contentMode = UIViewContentModeScaleAspectFill;
    shadeView_.clipsToBounds = YES;
    
    // 单击视频播放、暂停
    UITapGestureRecognizer *singleRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(singleTapped:)];
    [shadeView_ addGestureRecognizer:singleRecognizer];
    
    // 双击视频放大
    UITapGestureRecognizer *doubleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapFrom:)];
    doubleRecognizer.numberOfTapsRequired = 2;
    [shadeView_ addGestureRecognizer:doubleRecognizer];
    [singleRecognizer requireGestureRecognizerToFail:doubleRecognizer];
    
    // 长按视频下载
    UILongPressGestureRecognizer *videoLongPress = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(videoLongPressTap:)];
    [shadeView_ addGestureRecognizer:videoLongPress];
    
    // 风火轮
    [self initFenghuolun];
    [self.disPlayImageView addSubview:shadeView_];
    
    // 通知
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(thumbnailImageRequestDidFinish:) name:MPMoviePlayerReadyForDisplayDidChangeNotification object:nil];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerLoadState:) name:MPMoviePlayerLoadStateDidChangeNotification object:nil];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishedCallback:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:self.moviePlayer];
    
}

- (void)videoLongPressTap:(UILongPressGestureRecognizer *)gestureRecognizer {
    switch (gestureRecognizer.state)
    {
        case UIGestureRecognizerStateBegan:
        {
            UIActionSheet *saveVideoSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"保存视频", nil];
            saveVideoSheet.tag = 160;
            saveVideoSheet.actionSheetStyle = UIActionSheetStyleDefault;
            [saveVideoSheet showInView:self.contentView];
        }
            break;
        default:
            break;
    }
}

- (void)movieFinishedCallback:(NSNotification *)notification {
    NSLog(@"播放完成");
    UIImageView *playBtnImgView = [[UIImageView alloc]initWithFrame:CGRectMake((SCREEN_WIDTH-80)/2, (SCREEN_WIDTH-80)/2, 80, 80)];
    playBtnImgView.image = [UIImage imageNamed:@"bofang"];
    UIImageView *imageView = (UIImageView *)[self.disPlayImageView viewWithTag:101];
    [imageView addSubview:playBtnImgView];
}

- (void)playerLoadState:(NSNotification *)notification {
    NSLog(@"播放状态%ld",(long)self.moviePlayer.loadState);
    switch (self.moviePlayer.loadState) {
        case 3:
            // 风火轮 停止
            [self removeFenghuolun];
            break;
        default:
            break;
    }
}

- (void)thumbnailImageRequestDidFinish:(NSNotification *)notification {
    shadeView_.image = [[UIImage alloc]init];
}

- (void)singleTapped:(UITapGestureRecognizer *)tap {
    // 保存视频样式为非全屏状态
    [[NSUserDefaults standardUserDefaults]setBool:NO forKey:USERDEFAULTS_VIDEO_STYLE];
    [[NSUserDefaults standardUserDefaults]synchronize];
    
    // 清楚遮罩层View的播放ImageView
    for (UIView *view in shadeView_.subviews) {
        [view removeFromSuperview];
    }
    
    self.moviePlayer.playbackState == MPMoviePlaybackStatePlaying ? [self.moviePlayer pause] : [self.moviePlayer play];
}

- (void)handleDoubleTapFrom:(UITapGestureRecognizer *)tap {
    
    self.moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
    if (![self.moviePlayer isFullscreen]) {
        [[NSUserDefaults standardUserDefaults]setBool:YES forKey:USERDEFAULTS_VIDEO_STYLE];
        [[NSUserDefaults standardUserDefaults]synchronize];
        [self.moviePlayer setFullscreen:YES animated:YES];
    }else {
        [[NSUserDefaults standardUserDefaults]setBool:NO forKey:USERDEFAULTS_VIDEO_STYLE];
        [[NSUserDefaults standardUserDefaults]synchronize];
        [self.moviePlayer setFullscreen:NO animated:YES];
    }
}

- (void)removeMovieView {
    // 视频停止
    [self.moviePlayer pause];
    
    // 风火轮停止
    [self removeFenghuolun];
    
    UIImageView *playBtnImgView = [[UIImageView alloc]initWithFrame:CGRectMake((SCREEN_WIDTH-80)/2, (SCREEN_WIDTH-80)/2, 80, 80)];
    playBtnImgView.image = [UIImage imageNamed:@"bofang"];
    UIImageView *imageView = (UIImageView *)[self.disPlayImageView viewWithTag:101];
    imageView.image = nil;
    [imageView setImageWithURL:self.videoThumbnailImageUrl placeholderImage:nil];
    imageView.contentMode = UIViewContentModeScaleAspectFill;
    imageView.clipsToBounds = YES;
    [imageView addSubview:playBtnImgView];
}

- (void)playVideoFinished:(NSNotification *)theNotification{
    // 将视频视图从父视图中删除
    // self.moviePlayer.view.hidden = YES;
}


#pragma mark 
#pragma mark Delegate
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    
    // 播放视频流量提示
    if (alertView.tag == 100) {
        if (buttonIndex == 1) {
            [self.moviePlayer setContentURL:self.videoUrl];
            [self.moviePlayer play];
        }
    }
    
    // 删除动态
    if (alertView.tag == 101) {
        if (buttonIndex == 1) {
            dynamicHelper_ = [[BN_DynamicHelper alloc]init];
            [dynamicHelper_ removeDynamicWithPostId:self.postId completeHandler:^(id result, NSString *errMsg) {
                if (errMsg) {
                    [LZCHINT title:@"删除成功" type:LZCSuccess duration:3 places:HINT_PLACES callBack:NULL];
                // 列表刷新
                    NSString *tagStr = [NSString stringWithFormat:@"%ld",(long)self.tag];
                    NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
                    NSInteger isClassParent = [userDefault integerForKey:USERDEFAULTS_CLASSPARENT];
                    switch (isClassParent) {
                        case 0:
                            [[NSNotificationCenter defaultCenter]postNotificationName:K_CLASS_DELETE_NETARRAY_VALUE object:tagStr];
                            break;
                        case 1:
                            [[NSNotificationCenter defaultCenter]postNotificationName:K_PARENT_DELETE_NETARRAY_VALUE object:tagStr];
                            break;
                        default:
                            break;
                    }
                }
            }];
        }
    }
}

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    
    if (actionSheet.tag == 150) {
        switch (buttonIndex) {
            case 0:
            {
                if (_userType == ENUM_ROLE_PARENT) {
                    [self parentShareAction];
                }else {
                    [self deleteAction];
                }
            }
                break; // 家长收藏、其他删除
            case 1:
                [[NSNotificationCenter defaultCenter]postNotificationName:K_REPORT_INFO object:nil];
                break; // 举报
            default:
                break;
        }
    }// 分享按钮
    
    if(actionSheet.tag == 160) {
        switch (buttonIndex) {
            case 0:
            {
                /*NSString *urlStr = FORMAT_STR(_videoUrl);
                downloadNetVideo_ = [[iMB_DownloadNetVideo alloc]init];
                [downloadNetVideo_ toDownloadNetVideoUrl:urlStr downProgress:^(float progress) {
                    if (progress == 1) {
                        [SVProgressHUD dismiss];
                        NSString *fileName = NET_VIDEO_DOWNLOAD_FINISHED_NAME;
                        NSString *path = [Baby_DownLoad_Video stringByAppendingPathComponent:fileName];
                        NSURL *url = [NSURL fileURLWithPath:path];
                        ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
                        [library writeVideoAtPathToSavedPhotosAlbum:url completionBlock:^(NSURL *assetURL, NSError *error) {
                            if (error) {
                                [LZCHINT title:@"视频保存失败！" type:LZCError duration:3 places:HINT_PLACES callBack:NULL];// 保存提示失败
                            }else {
                                UIAlertView *finishedAlertView = [[UIAlertView alloc]initWithTitle:@"视频保存成功" message:@"您可以在 照片-相簿-相机胶卷 中查看" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
                                [finishedAlertView show];// 提示保存成功
                                
                                NSString *path = [Baby_DownLoad_Video stringByAppendingPathComponent:fileName];
                                if ([[NSFileManager defaultManager] fileExistsAtPath:path])
                                    [[NSFileManager defaultManager] removeItemAtPath:path error:nil];// 删除下载视频文件中的mp4
                            }
                        }];
                    }else {
                        [SVProgressHUD showProgress:progress status:@"正在保存视频..." maskType:SVProgressHUDMaskTypeClear];
                    }
                 }];*/
            }
                break;
            default:
                break;
        }
    }// 视频长按触发
}

- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
    for (UIView *view in actionSheet.subviews) {
        if (view.tag == 2) {
            UIButton *button = (UIButton *) view;
            // 改变背景
            [button setBackgroundImage:[button backgroundImageForState:UIControlStateHighlighted] forState:UIControlStateNormal];
            // 改变颜色
            [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
            // btn的选择状态,否则选择后不变背景
            [button setSelected:YES];
        } else {
            // code...
        }
    }
}

#pragma mark 
#pragma mark 工具

// 点赞动画
- (void)likeAnimation:(UIView *)zanView {
    [UIView animateWithDuration:0.3 animations:^{
        zanView.transform = CGAffineTransformMakeScale(1.2, 1.2);
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.3 animations:^{
            zanView.transform = CGAffineTransformMakeScale(0.9, 0.9);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.3 animations:^{
                zanView.transform = CGAffineTransformMakeScale(1.0, 1.0);
            } completion:^(BOOL finished) {
            }];
        }];
    }];
}

// 初始化风火轮
- (void)initFenghuolun {
    _hintView = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
    _hintView.center = shadeView_.center;
    [_hintView startAnimating];
    [shadeView_ addSubview:_hintView];
}

// 移除风火轮
- (void)removeFenghuolun {
    [_hintView stopAnimating];
    _hintView = nil;
    [_hintView removeFromSuperview];
}

#pragma mark dealloc
- (void)dealloc
{
    [[NSNotificationCenter defaultCenter]removeObserver:self name:
     KPUSHCONTROLLER_PINGLUN object:nil];
    [[NSNotificationCenter defaultCenter]removeObserver:self name:
     K_CLASS_LIKE_NETARRAY_VALUE object:nil];
    [[NSNotificationCenter defaultCenter]removeObserver:self name:
     K_CLASS_SHARE_NETARRAY_VALUE object:nil];
    [[NSNotificationCenter defaultCenter]removeObserver:self name:
     K_CLASS_DELETE_NETARRAY_VALUE object:nil];
    [[NSNotificationCenter defaultCenter]removeObserver:self name:
     K_PARENT_LIKE_NETARRAY_VALUE object:nil];
    [[NSNotificationCenter defaultCenter]removeObserver:self name:
     K_PARENT_SHARE_NETARRAY_VALUE object:nil];
    [[NSNotificationCenter defaultCenter]removeObserver:self name:
     K_PARENT_DELETE_NETARRAY_VALUE object:nil];
    [[NSNotificationCenter defaultCenter]removeObserver:self name:K_REPORT_INFO object:nil];
    [[NSNotificationCenter defaultCenter]removeObserver:self name:K_LOOK_OTHER_PERSONAL_INFO object:nil];
    
    self.cellHeight = 0;
    imageCount_ = 0;
    imgURLArr_ = nil;
    dynamicHelper_ = nil;
    
    for (UIView *view in self.contentView.subviews) {
        [view removeFromSuperview];
    }
}
@end
